package com.tt.aile.item.service;

import com.tt.aile.item.mapper.SpecGroupMapper;
import com.tt.aile.item.pojo.SpecGroup;
import com.tt.aile.item.pojo.SpecParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.RequestEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**对specgroup的操作
 * @author 86176 shkstrat
 * @date 2020/9/30 - 9:55
 */
@Service
public class SpecGroupService {

    @Autowired
    SpecGroupMapper specGroupMapper;

//根据cid查询
    public List<SpecGroup> querySpecGroupByCid(long cid) {

        SpecGroup record = new SpecGroup();
        record.setCid(cid);

        List specGroupList  = specGroupMapper.select(record);

        return specGroupList;

    }

//  新增specgroup
    @Transactional
    public void saveSpecGroup(SpecGroup specGroup) {

        this.specGroupMapper.insertSelective(specGroup);

    }
    //修改
    @Transactional
    public void updateNameById(String name,long id) {

        this.specGroupMapper.updateNameById(name,id);
    }
//删除
    @Transactional
    public void deleteSpecGroupById(long id) {

        this.specGroupMapper.deleteByPrimaryKey(id);
    }

}
